cmake_minimum_required(VERSION 3.20)

project(BoostDemo LANGUAGES CXX)

if (WIN32)
    set(BOOST_ROOT "D:/Boost/x64")
    set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include)
    set(Boost_USE_STATIC_RUNTIME ON) # 使用静态运行时库
endif (WIN32)

set(Boost_USE_STATIC_LIBS ON)   # 使用静态库
find_package(Boost 1.74.0 REQUIRED
        COMPONENTS regex system filesystem thread)
if (Boost_FOUND)
    include_directories(${Boost_INCLUDE_DIRS})

    MESSAGE(STATUS "Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS}.")
    MESSAGE(STATUS "Boost_LIBRARIES = ${Boost_LIBRARIES}.")
    MESSAGE(STATUS "Boost_LIB_VERSION = ${Boost_LIB_VERSION}.")

    add_subdirectory(FirstDemo)
    add_subdirectory(BoostAsioEchoServer)
    add_subdirectory(ChatRoom)
else ()
    message("can't find the boost library in path '${BOOST_ROOT}'")
endif ()
